package com.aabte.weather.weatherredis.weather;

import com.aabte.weather.weatherredis.city.dto.WeatherResponse;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping(path = "/weather")
@RestController
public class WeatherController {

    @Resource
    private WeatherDataService weatherDataService;

    @RequestMapping(path = "/city-id/{cityId}", method = RequestMethod.GET)
    public WeatherResponse getReportByCityId(@PathVariable(name = "cityId") String cityId) {
        return weatherDataService.getDataByCityId(cityId);
    }

    @RequestMapping(path = "/city-name/{cityName}", method = RequestMethod.GET)
    public WeatherResponse getReportByCityName(@PathVariable(name = "cityName") String cityName) {
        return weatherDataService.getDataByCityName(cityName);
    }

}
